//
//  HomeUser.swift
//  swift-微博
//
//  Created by chenrin on 2016/12/27.
//  Copyright © 2016年 zhuoheng. All rights reserved.
//

import UIKit

class HomeUser: NSObject {
    //用户ID
    var id : Int = 0
    //好友显示名称
    var name : String?
    //用户头像地址
    var profile_image_url : String?
    //是否是认证，true是，false不是
    var verified : Bool = false
    //会员等级
    var mbrank : Int = 0{
        didSet{
            if mbrank > 0 && mbrank < 7 {
                mbrankImage = UIImage(named: "common_icon_membership_level" + "\(mbrank)")
            }else{
                mbrankImage = nil
            }
        }
    }
    
    //用户的认证类型 ： -1 没有认证， 0 认证用户 ， 2，3，5 企业认证，220 达人
    var verified_type : Int = 6{
        didSet{
            switch verified_type {
            case 0:
                verifiedImage = UIImage(named: "avatar_vip")
            case 2,3,5:
                verifiedImage = UIImage(named: "avatar_enterprise_vip")
            case 220:
                verifiedImage = UIImage(named: "avatar_grassroot")
            default:
                verifiedImage = nil
            }
        }
    }
    
    ///保存认证图片
    var verifiedImage : UIImage?
    ///保存会员图片
    var mbrankImage : UIImage?
    
    
    init(dict:[String:Any]) {
        super.init()
        setValuesForKeys(dict)
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
    }
}
